<template>
  <div class="message-container">
      <div class="header">
      <h1>消息</h1>
    </div>
    <div class="message-list" @click="div1">
      <div class="message-item">
        <div :class="['message-icon', systemMessage.type]">
          <span>{{ systemMessage.count }}</span>
        </div>
        <div class="message-content">
          <div class="message-title">{{systemMessage.title }}</div>
          <div class="message-time">{{ systemMessage.time }}</div>
        </div>
      </div>
      <div class="message-item" v-for="(message, index) in messages" :key="index">
        <div :class="['message-icon', message.type]">
          <span>{{ message.count }}</span>
        </div>
        <div class="message-content">
          <div class="message-title">{{ message.title }}</div>
          <div class="message-time">{{ message.time }}</div>
        </div>
      </div>
    </div>
    <van-tabbar route>
      <van-tabbar-item replace to="/home" icon="home-o">首页</van-tabbar-item>
      <van-tabbar-item replace to="/NotificationList" icon="setting-o">消息</van-tabbar-item>
      <van-tabbar-item replace to="/mine" icon="friends-o">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>

export default {
  computed: {
    color() {
      return color
    }
  },
  data() {
    return {
    systemMessage:{
      title: '服务通知',
        time: '17:56',
      type: 'service',
      count: 3,
    },
      messages: [
        {
          title: '开黑通知',
          time: '17:56',
          type: 'game',
          count: 3,
        },
      ],
    };
  },
  methods: {
    div1(){
      this.$router.push('/inform')
    },
  }
};
</script>

<style scoped>
.message-container {
  padding: 20px;
  background-color: #f7f9fc;
  height: 100vh; /* 适配全屏高度 */
}

.header {
  text-align: center;
  margin-bottom: 20px;
}

.message-list {
  margin-top: 20px;
  flex-grow: 1;
}

.message-item {
  display: flex;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #eaeaea;
}

.message-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  margin-right: 10px;
  position: relative;
}

.message-icon.service {
  background-color: #00aaff; /* 蓝色 */
}

.message-icon.game {
  background-color: #ff4d4d; /* 红色 */
}

.message-content {
  flex-grow: 1;
}

.message-title {
  font-weight: bold;
}

.message-time {
  color: #999;
}

.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #fff;
  border-top: 1px solid #eaeaea;
  box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
}

.footer-icons {
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
}

.footer-icons li {
  list-style: none;
}
</style>
